Airport Network Analysis

Author

Farhan

Ego Network

Code
# Reading the dataset
ego_net_link = "https://notes.farhansadeek.com/dartmouth/math7/homework/Ego_Network.csv"
ego <- read.csv(ego_net_link)
ego_network <- graph_from_data_frame(ego, directed = FALSE)
plot(ego_network, vertex.size=5, vertex.label=NA)

Flight Network

Rows: 2152157 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 842905 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1088267 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1444224 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1905528 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 2042040 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1930868 Columns: 16
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (7): callsign, number, icao24, registration, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1985145 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1825015 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1894751 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1783384 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 1617845 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 2079436 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 2227362 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 2278298 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 2540487 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 2840201 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 2794400 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 2523676 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
Rows: 2726252 Columns: 15
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr  (6): callsign, number, aircraft_uid, typecode, origin, destination
dbl  (6): latitude_1, longitude_1, altitude_1, latitude_2, longitude_2, alti...
dttm (3): firstseen, lastseen, day

ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
[1] "5.2 Gb"
# A tibble: 6 × 17
  callsign number aircraft_uid   typecode origin destination firstseen          
  <chr>    <chr>  <chr>          <chr>    <chr>  <chr>       <dttm>             
1 SVA870   <NA>   82eff96d-11aa… B77W     <NA>   RPLL        2020-02-29 00:49:11
2 QFA64    QF64   92ac5351-d69f… B744     YSSY   YSSY        2020-02-29 01:00:11
3 LAN602   LA602  6058c095-d439… B789     KMIA   KLAX        2020-02-29 01:12:29
4 MAU440   MK440  e052860c-9157… A332     VAJJ   YPPH        2020-02-29 01:34:11
5 KQA784   <NA>   f4f16959-b038… B738     VABB   FACT        2020-02-29 01:44:10
6 <NA>     <NA>   92a2f681-cedb… C56X     <NA>   KOPF        2020-02-29 02:56:14
# ℹ 10 more variables: lastseen <dttm>, day <dttm>, latitude_1 <dbl>,
#   longitude_1 <dbl>, altitude_1 <dbl>, latitude_2 <dbl>, longitude_2 <dbl>,
#   altitude_2 <dbl>, icao24 <chr>, registration <chr>
Code
# Reading the dataset
flights <- read.csv("sampled_flights.csv") 
flights <- flights |> select(origin, destination) |> slice_sample(prop = 0.6, replace = FALSE) |> drop_na()
flight_network <- graph_from_data_frame(flights, directed = TRUE)
plot(flight_network, vertex.size=5, vertex.label=NA, edge.arrow.size=0.5)

Code
knitr::kable(head(flights))
origin destination
KORL KORL
KLCI KEWB
KDFW KTYS
KSLC KPDX
KMKE KIND
KHSD KHSD